package sysu.el.array.algors;

import java.util.List;

import javax.security.sasl.AuthorizeCallback;

/**
 * 
 * @author Edwin
 *
 * @param <T>
 */

public class ArrResort<T> {
	
	/**
	 * The first parameter and the last parameter cannot share one object.
	 * @param src
	 * @param num
	 * @param index
	 * @param dst
	 */
	public static<T> T[] ArrResort(T[] src, int num, int index[], T[] dst){
		for (int i=0; i<num; i++)
			dst[i] = src[index[i]];
		return dst;
	}
	
	public static<T> T[] ArrResort(List<T> src, int num, int index[], T[] dst){
		for (int i=0; i<num; i++)
			dst[i] = src.get(index[i]);
		return dst;
	}

	public static<T> T[] ArrResort(T[] src, int index[], T[] dst){
		return ArrResort(src, index.length, index, dst);
	}
	
	public static<T> T[] ArrResort(List<T> src, int index[], T[] dst){
		return ArrResort(src, index.length, index, dst);
	}
	
	public static String[] ArrResort(List<String> src, int index[]){
		return ArrResort(src, index, new String[index.length]);
	}
}
